%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This is part of the set of files that accompany the article:       %
%Mankiw, N. Gregory and Ricardo Reis (2007) "Sticky Information in  %
%General Equilibrium," Journal of the European Economic Association,%
%forthcoming. See the appendix of the NBER or CEPR working paper    %
%versions for a detailed explanation of the algorithms.             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Please cite if you use the programs. I do not provide tech support.%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Last revised: August 30, 2006                                      %
%Written by: Ricardo Reis                                           %
%Input: the MLE parameters in MLEresults.mat                        %
%Output: Figure 1                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%STEP 1: LOADING DATA %%%%%%%
clear; clc
global N; N=1000;     %periods in MA representations
load MLEresults.mat     %read data file with the pars_c and MLE vectors

%%%%STEP 2: PARAMETER INPUTS %%%%%%%
pars=pars_c;  %Calibrated parameters
pars(4)=MLE(1); pars(5)=MLE(2); pars(12)=MLE(3); pars(13)=MLE(4);
pars(14)=MLE(5); pars(15)=MLE(6); pars(16)=MLE(7); pars(17)=MLE(8); 
pars(18)=MLE(9); pars(19)=MLE(10); pars(20)=MLE(11); %MLE estimates
sigma_nu=pars(15); sigma_a=pars(11);  sigma_m=pars(9); sigma_g=pars(13); sigma_gam=pars(17);

%%%%STEP 3: SOLVE FOR MA REPRESENTATION %%%%%
[ma_m ma_a ma_g ma_nu ma_gam]=SIGEma(pars);

%%%%STEP 4: PLOT IRF TO ONE STANDARD DEVIATION SHOCKS%%%%%
SIGEirf(sigma_m*ma_m,sigma_a*ma_a,sigma_g*ma_g,sigma_nu*ma_nu,sigma_gam*ma_gam)